package com.itheima.appumeng.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;

import com.itheima.appumeng.R;
import com.umeng.analytics.MobclickAgent;

public class SplashActivity extends BaseActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                startActivity(new Intent(SplashActivity.this,MainActivity.class));
                finish();
            }
        },1000);
    }

    @Override
    protected void onResume() {
        super.onResume();
        // MobclickAgent.onPageStart("DetailActivity");//统计页面跳转
        //这样可以动态获取activnty的名字
        MobclickAgent.onPageStart(getClass().getSimpleName());//统计页面跳转

        MobclickAgent.onResume(this);       //  统计界面停留时长
    }

    @Override
    protected void onPause() {
        super.onPause();
        MobclickAgent.onPageEnd(getClass().getSimpleName());  //仅有Activity的应用中SDK自动调用，不需要单独写）保证 onPageEnd 在onPause 之前调用,因为 onPause 中会保存信息。"SplashScreen"为页面名称，可自定义
        MobclickAgent.onPause(this);
    }

}
